if(window.location=="http://www.like4like.org/user/bonus-page.php"){
	Next = function(param)
	{
			$('#result').empty(); 
			$('#result').append('<img width="60px" height="60px" src="http://www.like4like.org/img/loading/loading-blue-square.gif" title="Loading..." alt="Loading..." />');
			$('#result').show();
		  var dataString = "param=" + param;
		  $.ajax({
		  type: "POST",
		  url: "enterbonus-am.php",
		  data: dataString,
		  beforeSend: function(x) {
				if(x && x.overrideMimeType) {
					x.overrideMimeType("application/json;charset=UTF-8");
			}
			},
		  dataType: "json",
			error: function (request, status, error) {
				terajdalje("../index.php");
			},
		  success:function(response){
		  var linkovi = (typeof response.j) == 'string' ? eval('(' + response.j + ')') : response.j;
		  if (linkovi[0].uradio>0)
			{
				console.log("Success!!!");
				var tdcredits = '#earned-credits';
				var tablecredists = parseInt($(tdcredits).html()) +  parseInt(linkovi[0].uradio);
				$(tdcredits).html(tablecredists);
				$('#result').empty(); 
				$('#result').append('<p class="f-size-24 bold blue">You have won <span class="red">'+linkovi[0].uradio+'</span> credits!</p><br /><p class="f-size-12 bold">Thank you for chosing Like4Like.org</p>');
				$('#result').show();
				location.assign("http://www.like4like.org/user/earn-facebook-subscribes.php");
			}
			else
			{
				console.log("Faild!!!");
			}				
		  }
		});	
	}
	
	$("map area").each(function(){
		$(this).click();
		//Click
	});
	setTimeout(function(){location.assign("http://www.like4like.org/user/earn-facebook-subscribes.php");},5000);
}
if(window.location=="http://www.like4like.org/index.php"){
	location.assign("http://www.like4like.org/user/earn-facebook-subscribes.php");
}
var criss=[];
settimer =[];
var counttime = [];
var beforidlink = '';
function newbrojim(){
return function (targetUrl,idzad,idlink,idcl,vrsta,idnum)
	{
		if(counttime[idlink]<15) counttime[idlink]++;
		if(criss[idlink]===1 || counttime[idlink]>=15) 
			{ 
				//$('[id^=likebutton]').not('#likebutton'+idnum).show();
				clearInterval(settimer[idlink]); 
				counttime[idlink] = 0;
				triger = 'closed'; 
				$.ajax({
				 type: "POST",
				 url: "earn-facebook-subscribes-add-credit.php",
				 data: "url="+targetUrl+"&idzad="+idzad+"&idlinka="+idlink+"&idclana="+idcl+"&cnt="+cnt[idnum]+"&vrsta="+vrsta,
		  beforeSend: function(x) {
				if(x && x.overrideMimeType) {
					x.overrideMimeType("application/json;charset=UTF-8");
			}
			},
		  dataType: "json",
				error: function (request, status, error) {
				cnt[idnum] = "xZwiZIBqZVh";
				$('#'+idlink+'dv').fadeOut(0,function(){
						$('#'+idlink+'dv').empty();});
										
												$('#'+idlink+'dv').append("<a class='cursor' onclick='bnlinkreport("+idzad+",\""+idlink+"\",\"report\");'><img src='http://www.like4like.org/img/icon/report-a-problem.png' width='50px' height='30px' alt='Click On The Button And Report A Problem If You Can Not Earn Credits!' title='Click On The Button And Report A Problem If You Can Not Earn Credits!' /></a>");	
							$('#'+idlink+'dv').show();
												
				},			
				success: function(response){
				var linkovi = (typeof response.j) == 'string' ? eval('(' + response.j + ')') : response.j;
				if (linkovi[0].uradio!=0)
					{
						getcredits = "+"+$('#value-credits-'+idzad).text();
						cnt[idnum] = "xZwiZIBqZVh";
						$('#'+idlink+'dv').fadeOut(0,function(){
						$('#'+idlink+'dv').empty();});	
						$('#get-credits').show();
						 $('#get-credits').html(getcredits);
						 $('#get-credits').delay( 1000 ).fadeOut(2000,function(){
							$('#get-credits').html("");});
						document.getElementById('earned-credits').innerHTML = linkovi[0].uradio;	
									
										$('#'+idlink+'dv').append("<a class='cursor' onclick='bnlinkreport("+idzad+",\""+idlink+"\",\"report\");'><img src='http://www.like4like.org/img/icon/report-a-problem.png' width='50px' height='30px' alt='Click On The Button And Report A Problem If You Can Not Earn Credits!' title='Click On The Button And Report A Problem If You Can Not Earn Credits!' /></a>");	
						$('#'+idlink+'dv').show();
					}		
				else
					{
						skiplink(idzad,idlink);							
					}						
				}
				});
			}
	}
};

function newimageWin(){
	return function (pageURL, title, idzad, idlink, idcl, w, h, vrsta,idnum) 
	{
		if(newWin) newWin.close();
		criss[beforidlink]=1;
		if(beforidlink == idlink ) return false; 
		var y = Math.sqrt(idnum-2000);
		y = (y%1);
		if (y == 0)
		{		
			//$('[id^=likebutton]').not('#likebutton'+idnum).hide();
			URL = pageURL;
			if (vrsta=="website"){
			//pageURL = "http://www.freesocialmediatrends.com/l/wl.php?wlurl=" + pageURL;
			pageURL = "http://www.freesocialmediatrends.com/l/wl.php?wlurl=" + title;
			w = 200;
			h = 50;
			};
			var left = (screen.width/2)-(w/2);
			var top = (screen.height/2)-(h/2);
			if(triger == 'closed') 
			{ 
				criss[idlink]=0;
				counttime[idlink]=0;
				beforidlink = idlink;
				newWin = window.open(pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
				settimer[idlink] = setInterval("brojim('"+URL+"','"+idzad+"','"+idlink+"','"+idcl+"','"+vrsta+"','"+idnum+"')",1000);
			}
		}
	}
};

function newstartlinkb(){
	return false;
}
startlinkb = newstartlinkb();
imageWin = newimageWin();
brojim = newbrojim();
console.log("JS has inject!"); 
var list=$(".fld");
var numlist = list.length;
for (var i=0; i<numlist;i++){
	b = list[i].getElementsByTagName("img")[1];
	if(b){
		var a = list[i].getElementsByTagName("img")[1].getAttribute("src");
		if(a=="http://www.like4like.org/img/icon/antibot-top-1.png"){
			list[i].remove();
			numlist--;
		}
	}
};